package cn.edu.scau.cmi.linzhiyang.userInterface;

import cn.edu.scau.cmi.linzhiyang.adapter.AdapterOfClass;
import cn.edu.scau.cmi.linzhiyang.adapter.AdapterOfObject;
import cn.edu.scau.cmi.linzhiyang.adapter.Target;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;

public class AdapterController {
	@FXML
	private Label lab_3;
	@FXML
	private ChoiceBox choicebox;
	@FXML
	private Button btn;

	@FXML
	public void initialize() {
		ObservableList<String> list = FXCollections.observableArrayList("类适配器", "对象适配器");
		choicebox.setItems(list);
	}

	public void evenButton() {
		String string = (String) choicebox.getValue();
		switch (string) {
		case "类适配器":
			Target classTarget = new AdapterOfClass();
			lab_3.setText(classTarget.doTarget());
			break;
		case "对象适配器":
			Target objectTarget = new AdapterOfObject();
			lab_3.setText(objectTarget.doTarget());
			break;
		default:
			break;
		}
	}
}
